<template>
  <div>
    <c-title :hide="false" text="适用门店"></c-title>
    <van-search v-model="storeName" shape="round" placeholder="请输入搜索关键词" use-action-slot @input="searchChange"> </van-search>
    <div class="shop-title flex-a-c">
      <div class="nationwide">全国</div>
      <div class="nationwide-num">·{{ storeListByGoods.length }}家适用门店</div>
    </div>
    <div class="address-list">
      <div v-if="storeListByGoods.length > 0">
        <block v-for="(item, index) in storeListByGoods" :key="index" class="storeListBy">
          <div class="shop-content flex-j-sb flex-a-c  shopListUs">
            <div class="address">
              <div class="store-name ell">{{ item.name }}</div>
              <div class="address-details">{{ item.address }}</div>
              <div class="location flex-a-c">
                <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/consumption-coupons/location.png" v-if="locationStatus" />
                <span class="distance" v-if="locationStatus">距您{{ item.distance | kmUnit }} </span>
                <div class="navigation flex-a-c" @click.stop="navigation(item.latitude, item.longitude, item.name)">
                  <div>导航</div>
                  <span class="iconfont icon-advertise-next"></span>
                </div>
              </div>
            </div>
            <div class="mobile" @click.stop="callStore(item.phoneNumber)">
              <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/consumption-coupons/mobile.png" />
            </div>
          </div>

          <div class="mb20"></div>
        </block>
      </div>
      <van-empty description="空空如也" v-else />
    </div>
  </div>
</template>
<script>
import storeList_controller from "./storeList_controller.js";
export default storeList_controller;
</script>
<style lang="scss" scoped>
.mb20 {
  height: 0.625rem;
  clear: both;
}

.shop-title {
  background-color: #fff;
  padding: 0 0 0.9375rem 0.875rem;

  .nationwide {
    font-size: 0.9375rem;
    color: #222;
    margin-right: 0.1875rem;
  }

  .nationwide-num {
    color: #555;
    font-size: 0.875rem;
  }
}

.storeListBy {
  margin-bottom: 0.625rem;
}

.address-list {
  margin: 0.625rem 0.625rem 0 0.625rem;
}

.ell {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  /* 定义显示的行数 */
  overflow: hidden;
}

.shopListUs {
  padding: 0.8438rem 0.75rem 0.8125rem 0.7813rem;
}

.shop-content {
  width: 100%;
  background-color: #fff;

  .location img {
    width: 0.5625rem;
    height: 0.6875rem;
    margin: 0 0.4375rem 0 0;
  }
}

.location img {
  width: 0.5625rem;
  height: 0.6875rem;
  margin: 0 0.4375rem 0 0;
}

.shop-content .mobile {
  width: 1.875rem;
  height: 1.875rem;

  img {
    width: 1.875rem;
    height: 1.875rem;
  }
}

.address {
  // width: 100%;
  .store-name {
    font-size: 0.9375rem;
    color: #222;
    margin: 0 0 0.4688rem 0;
    text-align: left;
  }

  .address-details {
    font-size: 0.8125rem;
    color: #222;
    margin: 0 0 0.4688rem 0;
    text-align: left;
  }
}

.location {
  .distance {
    font-size: 0.75rem;
    color: #555;
    margin: 0 0.875rem 0 0;
  }

  .navigation {
    font-size: 0.75rem;
    color: #ff3a00;
    cursor: pointer;
  }
}
</style>
